package com.mccree.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Email;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Validated
public class Employee {
    private Integer id;
    private String lastName;
    @Email(message = "格式错误")
    private String email;
    //1 male , 0 female
    private Integer gender;
//    private Integer deId;
    private Department department;
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date birth;

    public Employee(Integer id, String lastName, @Email(message = "格式错误") String email, Integer gender, Department department) {
        this.id = id;
        this.lastName = lastName;
        this.email = email;
        this.gender = gender;
        this.birth = new Date();
        this.department = department;
    }
}
